home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Modules / BackSpaceModules / Source / PlanetView / PlanetView.h < prev    next >
Encoding:
Text File  |  1992-08-04  |  1.3 KB  |  49 lines

  1. #import <appkit/View.h>
  2. #import <dpsclient/event.h>
  3.  
  4. // Constants
  5. #define PLANETS    30        // default number of planets
  6. #define MAXPLANETS 42    // maximum number of planets
  7. #define MAXITERATIONS 30000
  8. #define SPACEDIST 2        // # of pixels = 1 unit of space distance
  9. #define DEFAULTGRAV 1    /* Default gravity for new planet*/
  10. #define MAXGRAVITY (MAXPLANETS * DEFAULTGRAV)
  11. #define PI 3.14159
  12.  
  13. /* Macros */
  14. #define deltaX(a,b) ((myplanets[b].x - myplanets[a].x)/SPACEDIST)    /* addressing into dynamic array */
  15. #define deltaY(a,b) ((myplanets[b].y - myplanets[a].y)/SPACEDIST)    /* addressing into dynamic array */
  16. #define SQR(v)    (v*v) /* fast square */
  17.  
  18. typedef struct
  19.     {
  20.     NXCoord    x, y;        /* planet positions x[planet] NXcoord is a float*/
  21.     float    gravity;    /* planet gravity gravity[planet] */
  22.     float    xv, yv;        /* planet velocities xv[planet] */
  23.     } aplanet;
  24.  
  25.  
  26. @interface PlanetView : View
  27. {
  28.     int    numplanets;
  29.     int    initialNumplanets;
  30.     aplanet *myplanets;
  31.     id    numplanetTextField;
  32.     id    numplanetSlider;
  33.     id inspectorPanel;
  34.     int iterationCount;
  35.     float gfactor;
  36. }
  37.  
  38. - createUniverse;
  39. - constrainGravity:(int)i;
  40. - setNumberPlanets:sender;
  41. - merge: (int) i: (int) j;
  42. - setGFactor:sender;
  43. - oneStep;
  44. - constrainPosition:(int)i;
  45. - newPlanet: (aplanet *) newplanet: (float) width: (float) height;
  46. - blowPlanet: (int) planetNum;
  47. @end
  48.  
  49.